<div class="actor" *ngIf="actor">
  <div class="actor-img-edit-container">
    <div class="banner-placeholder">
      <img *ngIf="hasBanner()" [src]="preview || actor.bannerUrl" alt="Banner" />
    </div>

    <div *ngIf="!hasBanner()" class="actor-img-edit-button button-focus-within" [ngbTooltip]="bannerFormat" placement="right" container="body">
      <ng-container *ngTemplateOutlet="uploadNewBanner"></ng-container>
    </div>

    <div *ngIf="hasBanner()" ngbDropdown placement="right">
      <button type="button" class="actor-img-edit-button" ngbDropdownToggle>
        <my-global-icon iconName="edit"></my-global-icon>
        <label for="bannerMenu" i18n>Change your banner</label>
      </button>

      <div ngbDropdownMenu>
        <div class="dropdown-item dropdown-file button-focus-within" [ngbTooltip]="bannerFormat">
          <ng-container *ngTemplateOutlet="uploadNewBanner"></ng-container>
        </div>

        <button type="button" class="dropdown-item" (click)="deleteBanner()">
          <my-global-icon iconName="delete"></my-global-icon>
          <span i18n>Remove banner</span>
        </button>
      </div>
    </div>
  </div>
</div>

<ng-template #uploadNewBanner>
  <my-global-icon iconName="upload"></my-global-icon>
  <span for="bannerfile" i18n>Upload a new banner</span>
  <input #bannerfileInput type="file" name="bannerfile" id="bannerfile" [accept]="bannerExtensions" (change)="onBannerChange(bannerfileInput)"/>
</ng-template>
